<template>
    <el-container>
        <el-container style="height: 520px">
            <el-header>
                <el-form
                    inline
                    label-width="49px"
                    :model="queryList"
                    style="margin-top: 5px; width: 100%"
                >
                    <el-input
                        placeholder="---请输入用户编号---"
                        v-model="queryList.accountCode"
                        style="width: 180px"
                        @keyup.enter="$refs.mytable.getData()"
                    />&nbsp;
                    <el-input
                        placeholder="---请输入用户名称---"
                        v-model="queryList.realName"
                        style="width: 180px"
                        @keyup.enter="$refs.mytable.getData()"
                    />&nbsp;
                    <el-input
                        placeholder="---请输入用户手机号---"
                        v-model="queryList.mobile"
                        style="width: 180px"
                        @keyup.enter="$refs.mytable.getData()"
                    />&nbsp;
                    <el-button type="primary" @click="$refs.mytable.getData()">查询</el-button>
                </el-form>
            </el-header>
            <el-foot>
                <scTable
                    ref="mytable"
                    :queryType="queryType"
                    checkStrictly
                    :queryList="queryList"
                    :column="columnList"
                    :sort-orders="['ascending', 'descending']"
                    @selection-change="selectionChange"
                    row-key="key"
                    stripe
                    show-summary
                    remoteSummary
                    style="height: 450px; min-width: 500"
                >
                    <el-table-column type="selection" width="50" ></el-table-column>
                    <el-table-column label="用户ID" prop="accountId" width="100" sortable></el-table-column>
                    <el-table-column label="用户编码" prop="accountCode" width="120" sortable></el-table-column>
                    <el-table-column label="用户名称" prop="realName" width="150" sortable></el-table-column>
                    <el-table-column label="手机号" prop="mobile" width="140" sortable></el-table-column>
                    <el-table-column label="机构类型" prop="accountTypeDesc" width="140" sortable></el-table-column>
                    <el-table-column label="机构名称" prop="orgName" width="140" sortable></el-table-column>
                </scTable>
            </el-foot>
        </el-container>
    </el-container>
</template>
<script>
import publicjs from "@/api/model/publicjs";
export default {
    components: {
        publicjs,
    },
    props: {
        queryType: { type: String, default: "account/pages" },
        defaultQueryList: { type: Object, default: {} },
    },
    watch: {
        defaultQueryList: {
            handler(newVal,oldVal) { 
                this.queryList = { ...this.defaultQueryList,...newVal }; 
                this.$refs.mytable.getData();
            },
        }
    },
    data() {
        return {
            selectionRows: [],
            attrList: {},
            valueList: {},
            queryList: {},
            result: "", // 运行结果
            props1: {
                checkStrictly: true,
                emitPath: false,
            },
           
        };
    },
    methods: {
        //表格选择后回调事件
        selectionChange(selection) {
            this.selectionRows = selection;
        },
        async opBindData() {
            console.log(111);
            console.log(this.defaultQueryList);

            this.queryList = { ...this.queryList, ...this.defaultQueryList };
            this.$nextTick(() => {
                this.$refs.mytable.getData();
            });
        },
        async initOptions() {},
    },
    async mounted() {
        await this.initOptions();
        await this.opBindData();
    },
};
</script>